import java.lang.reflect.Method;

import per.jdz.MyAnnotation;
import per.jdz.MyClass;

public class App {
    public static void main(String[] args) throws Exception {
        Class<MyClass> clazz = MyClass.class;
        
        // 检查类级别的注解
        if (clazz.isAnnotationPresent(MyAnnotation.class)) {
            System.out.println("MyClass is annotated with MyAnnotation");
        } else {
            System.out.println("MyClass is not annotated with MyAnnotation");
        }

        // 检查方法级别的注解
        Method method = clazz.getMethod("myMethod");
        if (method.isAnnotationPresent(MyAnnotation.class)) {
            System.out.println("myMethod is annotated with MyAnnotation");
        } else {
            System.out.println("myMethod is not annotated with MyAnnotation");
        }
    }
}
